<!--
 * @Description: 首页组件
 * @Author: hai-27
 * @Date: 2020-02-07 16:23:00
 * @LastEditors: hai-27
 * @LastEditTime: 2020-02-27 13:36:12
 -->
<template>
  <div class="home" id="home" name="home">
    <!-- 轮播图 -->
    <div class="block">
      <el-carousel height="460px">
        <el-carousel-item v-for="item in carousel" :key="item.carousel_id">
          <img style="height:460px;" :src="item.imgPath" :alt="item.describes" />
        </el-carousel-item>
      </el-carousel>
    </div>
    <!-- 轮播图END -->
    <div class="main-box">
      <div class="main">
        <!-- 计算机软件展示区域 -->
        <div class="phone">
          <div class="box-hd">
            <div class="title">计算机软件</div>
          </div>
          <div class="box-bd">
            <div class="promo-list">
              <router-link to>
                <img src="../assets/imgs/app.png" />
              </router-link>
            </div>
            <div class="list">
              <MyList :list="phoneList" :isMore="true"></MyList>
            </div>
          </div>
        </div>
        <!-- 计算机软件展示区域END -->

        <!-- 文档展示区域 -->
        <div class="appliance" id="promo-menu">
          <div class="box-hd">
            <div class="title">文档</div>
            <div class="more" id="more">
              <MyMenu :val="2" @fromChild="getChildMsg">
                <span slot="1">热门</span>
                <span slot="2">毕业论文</span>
              </MyMenu>
            </div>
          </div>
          <div class="box-bd">
            <div class="promo-list">
              <ul>
                <li>
                  <img src="../assets/imgs/dingzhi.jpg" />
                </li>
                <li>
                  <img src="../assets/imgs/dianziban.jpg" />
                </li>
              </ul>
            </div>
            <div class="list">
              <MyList :list="applianceList" :isMore="true"></MyList>
            </div>
          </div>
        </div>
        <!-- 文档展示区域END -->

        <!-- 配件商品展示区域 -->
        <div class="accessory" id="promo-menu">
          <div class="box-hd">
            <div class="title">视听娱乐</div>
            <div class="more" id="more">
              <MyMenu :val="3" @fromChild="getChildMsg2">
                <span slot="1">热门</span>
                <span slot="2">视频</span>
                <span slot="3">音乐</span>
              </MyMenu>
            </div>
          </div>
          <div class="box-bd">
            <div class="promo-list">
              <ul>
                <li>
                  <img src="../assets/imgs/shipinzhizuo.jpg" alt />
                </li>
                <li>
                  <img src="../assets/imgs/rumenjingtong.jpg" alt />
                </li>
              </ul>
            </div>
            <div class="list">
              <MyList :list="accessoryList" :isMore="true"></MyList>
            </div>
          </div>
        </div>
        <!-- 配件商品展示区域END -->
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      carousel: [{
        carousel_id: 1,
        imgPath: require('../assets/imgs/fengmian.jpg'),
        describes: "123456"
      },{
        carousel_id: 2,
        imgPath: require('../assets/imgs/jiqiao.jpg'),
        describes: "123456"
      },{
        carousel_id: 3,
        imgPath: require('../assets/imgs/wuqi.jpg'),
        describes: "123456"
      },{
        carousel_id: 4,
        imgPath: require('../assets/imgs/dazhe.jpg'),
        describes: "123456"
      }], // 轮播图数据
      phoneList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "360安全卫士作为业界领先的安全杀毒产品，可精准查杀各类木马病毒，始终致力于守护用户的电脑安全。不仅如此，我们还开发了多款功能，提高您的电脑使用效率。",
          product_name: "360安全卫士",
          product_num: 10,
          product_picture: require('../assets/imgs/360.png'),
          product_price: 99,
          product_sales: 0,
          product_selling_price: 49,
          product_title: "无限安全，无限精彩"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "可以实现LOL换肤、无限视距等功能，在选择英雄界面可自动识别要选的英雄，方便快捷。",
          product_name: "lol兔子换肤助手",
          product_num: 10,
          product_picture: require('../assets/imgs/tuzi.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "静态换肤、无限视距、选英雄自动识别"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "汇聚江苏台微信矩阵粉丝，多位明星大咖直播间专访，弹幕互动、微视频和语音上传等行业领先的趣味化功能让你与主播“面对面”对话。",
          product_name: "大蓝鲸 v6.0",
          product_num: 10,
          product_picture: require('../assets/imgs/yu.jpg'),
          product_price: 79,
          product_sales: 0,
          product_selling_price: 59,
          product_title: "互动属性强 功能多样化 玩法多样，惊喜重重"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "各大校园网免费上网",
          product_name: "Dr.COM宽带认证客户端",
          product_num: 10,
          product_picture: require('../assets/imgs/kuandai.jpg'),
          product_price: 299,
          product_sales: 0,
          product_selling_price: 179,
          product_title: "破解版"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "体验最新的角色和地图",
          product_name: "原神",
          product_num: 10,
          product_picture: require('../assets/imgs/yuanshen.jpg'),
          product_price: 399,
          product_sales: 0,
          product_selling_price: 329,
          product_title: "内鬼测试服"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "视角无遮掩，无死角",
          product_name: "原神",
          product_num: 10,
          product_picture: require('../assets/imgs/yuanshen2.jpg'),
          product_price: 399,
          product_sales: 0,
          product_selling_price: 329,
          product_title: "福利未删减版"
        }
      ], // 计算机软件列表
      miTvList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          product_name: "a++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "a省略号"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
          product_name: "b++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "b省略号"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        }
      ], // 小米电视商品列表
      applianceList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "围绕两个重组家庭展开，讲述了四个性情迥异的的子女，在各种烦恼困扰与矛盾的过程中慢慢走向融合的故事",
          product_name: "家有女儿初长成",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 39,
          product_sales: 0,
          product_selling_price: 29,
          product_title: "都市 情景 喜剧"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "这里是属于斗气的世界，没有花俏艳丽的魔法，有的，仅仅是繁衍到巅峰的斗气。",
          product_name: "斗破苍穹",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 59,
          product_sales: 0,
          product_selling_price: 49,
          product_title: "玄幻 穿越"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "穿越到斗罗大陆的唐三如何一步步修炼武魂，由人修炼为神，最终铲除了斗罗大陆上的邪恶力量，报了杀母之仇，成为斗罗大陆最强者",
          product_name: "斗罗大陆",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 59,
          product_sales: 0,
          product_selling_price: 49,
          product_title: "玄幻"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "他，是从来没有温度的高冷禁欲系男神帅气多金的年轻总裁。",
          product_name: "霸道总裁爱上我",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 49,
          product_sales: 0,
          product_selling_price: 29,
          product_title: "都市 言情"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "落魄程序员在线炒粉",
          product_name: "从入门到入土",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 99,
          product_sales: 0,
          product_selling_price: 79,
          product_title: "程序员之道"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "佛教经典：统称；藏经，俗称；佛经，也叫《大藏经》，一般由经、律、论三部分组成。",
          product_name: "佛经",
          product_num: 10,
          product_picture: require('../assets/imgs/wendang.jpeg'),
          product_price: 149,
          product_sales: 0,
          product_selling_price: 129,
          product_title: "大藏经浩如烟海"
        }
      ], // 文档商品列表
      applianceHotList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          product_name: "a++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "a省略号"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
          product_name: "b++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "b省略号"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        }
      ], //热门家电商品列表
      accessoryList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "蜘蛛侠的生活因曝光身份而陷入混乱，甚至遭到了全世界民众的愤怒抗议，为改变这一切，蜘蛛侠前往寻求奇异博士的帮助，没料想，多元宇宙打开后更大的危机也随之而来",
          product_name: "蜘蛛侠：英雄无归",
          product_num: 10,
          product_picture: require('../assets/imgs/zhizhu.jpg'),
          product_price: 149,
          product_sales: 0,
          product_selling_price: 129,
          product_title: "科幻 动作 冒险"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "我也不解释",
          product_name: "学习资料",
          product_num: 10,
          product_picture: require('../assets/imgs/yingshi.jpg'),
          product_price: 279,
          product_sales: 0,
          product_selling_price: 259,
          product_title: "懂的都懂"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "讲述肖央饰演的父亲林日朗为救儿子走投无路放手一搏的故事",
          product_name: "误杀2",
          product_num: 10,
          product_picture: require('../assets/imgs/wusha.jpg'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "犯罪 家庭"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "只要你敢买我就敢教",
          product_name: "一天速成高级工程师",
          product_num: 10,
          product_picture: require('../assets/imgs/yingshi.jpg'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "试试就逝世"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "跌宕起伏",
          product_name: "广东财经大学校歌",
          product_num: 10,
          product_picture: require('../assets/imgs/mp3.jpg'),
          product_price: 19,
          product_sales: 0,
          product_selling_price: 9,
          product_title: "歌声飞扬"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "春天，万物复苏，是交配的好季节",
          product_name: "动物世界",
          product_num: 10,
          product_picture: require('../assets/imgs/mp3.jpg'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "交配的世界"
        }
      ], //视听娱乐商品列表
      accessoryHotList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          product_name: "a++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "a省略号"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
          product_name: "b++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "b省略号"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        }
      ], //热门配件商品列表
      protectingShellList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          product_name: "a++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "a省略号"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
          product_name: "b++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "b省略号"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        }
      ], // 保护套商品列表
      chargerList: [
        {
          category_id: 1,
          product_id: 1,
          product_intro: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          product_name: "a++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "a省略号"
        },
        {
          category_id: 1,
          product_id: 2,
          product_intro: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
          product_name: "b++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "b省略号"
        },
        {
          category_id: 1,
          product_id: 3,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 4,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 5,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        },
        {
          category_id: 1,
          product_id: 6,
          product_intro: "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
          product_name: "c++++++",
          product_num: 10,
          product_picture: require('../assets/imgs/cart-empty.png'),
          product_price: 199,
          product_sales: 0,
          product_selling_price: 99,
          product_title: "c省略号"
        }
      ], //充电器商品列表
      applianceActive: 1, // 家电当前选中的商品分类
      accessoryActive: 1 // 配件当前选中的商品分类
    };
  },
  watch: {
    // 家电当前选中的商品分类，响应不同的商品数据
    applianceActive: function(val) {
      // 页面初始化的时候把applianceHotList(热门家电商品列表)直接赋值给applianceList(家电商品列表)
      // 所以在切换商品列表时判断applianceHotList是否为空,为空则是第一次切换,把applianceList赋值给applianceHotList
      if (this.applianceHotList == "") {
        this.applianceHotList = this.applianceList;
      }
      if (val == 1) {
        // 1为热门商品
        this.applianceList = this.applianceHotList;
        return;
      }
      if (val == 2) {
        // 2为电视商品
        this.applianceList = this.miTvList;
        return;
      }
    },
    accessoryActive: function(val) {
      // 页面初始化的时候把accessoryHotList(热门配件商品列表)直接赋值给accessoryList(配件商品列表)
      // 所以在切换商品列表时判断accessoryHotList是否为空,为空则是第一次切换,把accessoryList赋值给accessoryHotList
      if (this.accessoryHotList == "") {
        this.accessoryHotList = this.accessoryList;
      }
      if (val == 1) {
        // 1为热门商品
        this.accessoryList = this.accessoryHotList;
        return;
      }
      if (val == 2) {
        // 2为保护套商品
        this.accessoryList = this.protectingShellList;
        return;
      }
      if (val == 3) {
        //3 为充电器商品
        this.accessoryList = this.chargerList;
        return;
      }
    }
  },
  created() {
    // 获取轮播图数据
    /* this.$axios
      .post("/api/resources/carousel", {})
      .then(res => {
        this.carousel = res.data.carousel;
      })
      .catch(err => {
        return Promise.reject(err);
      }); */
    // 获取各类商品数据
    /* this.getPromo("手机", "phoneList"); */
    /* this.getPromo("电视机", "miTvList");
    this.getPromo("保护套", "protectingShellList");
    this.getPromo("充电器", "chargerList");
    this.getPromo(
      ["电视机", "空调", "洗衣机"],
      "applianceList",
      "/api/product/getHotProduct"
    );
    this.getPromo(
      ["保护套", "保护膜", "充电器", "充电宝"],
      "accessoryList",
      "/api/product/getHotProduct"
    ); */
  },
  methods: {
    // 获取家电模块子组件传过来的数据
    getChildMsg(val) {
      this.applianceActive = val;
    },
    // 获取配件模块子组件传过来的数据
    getChildMsg2(val) {
      this.accessoryActive = val;
    },
    // 获取各类商品数据方法封装
    getPromo(categoryName, val, api) {
      api = api != undefined ? api : "/api/product/getPromoProduct";
      this.$axios
        .post(api, {
          categoryName
        })
        .then(res => {
          this[val] = res.data.Product;
        })
        .catch(err => {
          return Promise.reject(err);
        });
    }
  }
};
</script>
<style scoped>
@import "../assets/css/index.css";
</style>